﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class user_photofilt : NetCMS.Web.UI.UserPage
{
    Photo pho = new Photo();
    protected string sImgUrl = "";
    protected int photocount = 0;
    protected string photostr = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.CacheControl = "no-cache";
        
        getPhoto();

    }
    protected void getPhoto()
    {
        string PhotoalbumID =Request.QueryString["PhotoalbumID"];
        string pwd = pho.sel_getUserInfo(PhotoalbumID).Rows[0]["pwd"].ToString();
        string UserNum = pho.sel_getUserInfo(PhotoalbumID).Rows[0]["UserName"].ToString();
        if (pwd != "" && pwd != null && UserNum != NetCMS.Global.Current.UserNum)
        {
            Response.Redirect("Photoalbumlist.aspx");
        }
        else
        {
            DataTable dt = pho.sel_photoUrl(PhotoalbumID);
            photocount = dt.Rows.Count;
            if (dt != null)
            {
                string dirDumm = NetCMS.Config.UIConfig.dirDumm;
                if (dirDumm.Trim() != "")
                    dirDumm = "/" + dirDumm;

                photostr += "ImgName = new ImgArray(" + photocount + ");\n";
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    photostr += "ImgName[" + i + "] =\"" + dt.Rows[i][0].ToString().ToLower().Replace("{@userdirfile}", dirDumm + NetCMS.Config.UIConfig.UserdirFile) + "\";\n";
                }
                dt.Dispose();
            }
            DataBind();
        }
    }
}